import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

import Joy from './views/joy.vue'
import Sport from './views/sport.vue'
import Flim from './views/flim.vue'
import NotFound from '@/views/NotFound'

import Singer from '@/views/cool/singer.vue'
import Tvoc from '@/views/cool/tvoc.vue'
import Sailng from '@/views/cool/sailng.vue'


// 导入路由
import VueRouter from 'vue-router'

// 安装插件
Vue.use(VueRouter)


// 配置路由规则
let routes = [
  {
    path: '/',
    redirect: '/joy'
  },
  {
    name: 'Joy',
    path: '/joy',
    component: Joy,
    children: [
      {
        path: 'singer',
        component: Singer
      },
      {
        path: 'tvoc',
        component: Tvoc
      },
      {
        path: 'sailng',
        component: Sailng
      }
    ]
  },
  {
    name: 'Sport',
    path: '/sport',
    component: Sport
  },
  {
    name: 'Flim',
    path: '/flim',
    component: Flim
  },
  {
    path: '*',
    component: NotFound
  }
]
// 根据路由规则创建路径对象
let router = new VueRouter({
  routes,
  // 设置路由模式
  mode: 'hash'
})
// 设置路由模式

new Vue({
  render: h => h(App),
  router
}).$mount('#app')
